package ioperations;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOPeration{

    public void work(BookList bookList) {
        System.out.println("Find operation");

        int currentSize =bookList.getUsedSize();

        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the name of the book:");
        String name = sc.nextLine();

        for(int i =0; i < currentSize; i++){
            if(name.equals(bookList.getBook(i).getName())){
                System.out.println("找到了" + bookList.getBook(i));
                return;
            }
        }

        System.out.println("没找到");


    }
}
